#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int a, n;
	scanf("%d %d", &a, &n);
	int sum = 0;
	int sum1= 0;
	int t = n;
	int j = 1;
	int k = n;
	while (n > 0) {
		t = n;
		for (j = 1; t > 1; t--) {
			j *= 10;
		}
		sum1 += a * j;
		j = 1;
		n--;
	}
	int first = 1;
	for (first = 1; j < k; j++) {
		first *= 10;
	}
	for (n = 0; n < k; n++) {
		sum += sum1;
		sum1 %= first;
		first /= 10;
	}
	printf("%d",sum);

	return 0;
}